//
//  ADPermissionManager.h
//  ADKit
//
//  Created by duzexu on 2017/12/21.
//

#import <Foundation/Foundation.h>

#define AD_PERMISSION_ALBUM (1)
#define AD_PERMISSION_CONTACT (0)
#define AD_PERMISSION_CALENDAR (0)
#define AD_PERMISSION_MEDIA (0)

typedef NS_ENUM(NSUInteger, ADAuthorityStatus) {
    ADAuthorityStatusNotDetermined = 0,
    ADAuthorityStatusRestricted,
    ADAuthorityStatusDenied,
    ADAuthorityStatusAuthorized,
    ADAuthorityStatusOff //only vaild for location and health
};

typedef NS_ENUM(NSUInteger, ADAuthorityType) {
    ADAuthorityTypeAlbum, //相册
    ADAuthorityTypeCamera, //相机
    ADAuthorityTypeContact, //通讯录
    ADAuthorityTypeMic, //麦克风
    ADAuthorityTypeMedia, //媒体
    ADAuthorityTypeLocation, //定位
    ADAuthorityTypeNotification, //通知
    ADAuthorityTypeCalendar, //日历
    ADAuthorityTypeReminder, //提醒
};

typedef NS_ENUM(NSUInteger,ADLocationType){
    ADLocationTypeWhenInUse = 0, // location when in use
    ADLocationTypeAlway = 1  // alway location
};

typedef void(^ADPermissonStatusBlock)(ADAuthorityStatus status);

@class ADPermissionEntity;
@interface ADPermissionManager : NSObject

+ (void)openAppSetting;

+ (ADPermissionEntity *)defaultPermissionEntity;

+ (ADAuthorityStatus)checkAuthorityWithType:(ADAuthorityType)type;

+ (void)requestPermissionWithType:(ADAuthorityType)type status:(ADPermissonStatusBlock)statusBlock;

@end

@interface ADPermissionEntity : NSObject

/**
 定位类型
 */
@property (nonatomic, assign) ADLocationType locationType;

/// 通知相关
/*!
 * 支持的类型
 * badge,sound,alert
 */
@property (nonatomic, assign) NSInteger types;
/*!
 * 注入的类别
 * iOS10 UNNotificationCategory
 * iOS8-iOS9 UIUserNotificationCategory
 */
@property (nonatomic, strong) NSSet *categories;

///健康相关
/**
 需要分享的类型 HKSampleType
 */
@property (nonatomic, strong) NSSet *typesToShare;
/**
 需要读取的类型 HKObjectType
 */
@property (nonatomic, strong) NSSet *typesToRead;

@end
